#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/wait.h>

int main()
{
        char* const env[] = {
                (char*)"haha=hehe",
                (char*)"PATH=/"
        };
        printf("i am a process, pid: %d\n", getpid());

        pid_t id = fork();
        if(id == 0)
        {
                sleep(1);
                execle("./mytest", "mytest", NULL, env);
                printf("execl end....\n");
                exit(1);
        }

        pid_t rid = waitpid(id, NULL, 0);
        if(rid > 0)
        {
                printf("wait success\n");
        }

        exit(1);
}
